Imports cmplib01

Public Class frmNewSingleUnit
    Inherits System.Windows.Forms.Form

    Private ptrNewUnit As ChitUnitTypeMember
    Private ptrCurrentGame As CampaignerGameData

    Private m_CancelPressed As Boolean


#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    Friend WithEvents cruUnit As CTest.ctlCreateUnit
    Friend WithEvents btnCancel As System.Windows.Forms.Button
    Friend WithEvents btnOK As System.Windows.Forms.Button
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.cruUnit = New CTest.ctlCreateUnit
        Me.btnCancel = New System.Windows.Forms.Button
        Me.btnOK = New System.Windows.Forms.Button
        Me.SuspendLayout()
        '
        'cruUnit
        '
        Me.cruUnit.Location = New System.Drawing.Point(8, 8)
        Me.cruUnit.Name = "cruUnit"
        Me.cruUnit.Size = New System.Drawing.Size(568, 400)
        Me.cruUnit.TabIndex = 0
        Me.cruUnit.Unit = Nothing
        '
        'btnCancel
        '
        Me.btnCancel.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
        Me.btnCancel.BackColor = System.Drawing.Color.LightSkyBlue
        Me.btnCancel.FlatStyle = System.Windows.Forms.FlatStyle.Flat
        Me.btnCancel.Location = New System.Drawing.Point(496, 416)
        Me.btnCancel.Name = "btnCancel"
        Me.btnCancel.TabIndex = 26
        Me.btnCancel.Text = "Cancel"
        '
        'btnOK
        '
        Me.btnOK.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left), System.Windows.Forms.AnchorStyles)
        Me.btnOK.BackColor = System.Drawing.Color.LightSkyBlue
        Me.btnOK.FlatStyle = System.Windows.Forms.FlatStyle.Flat
        Me.btnOK.Location = New System.Drawing.Point(416, 416)
        Me.btnOK.Name = "btnOK"
        Me.btnOK.TabIndex = 25
        Me.btnOK.Text = "OK"
        '
        'frmNewSingleUnit
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.BackColor = System.Drawing.Color.Black
        Me.ClientSize = New System.Drawing.Size(584, 446)
        Me.Controls.Add(Me.btnCancel)
        Me.Controls.Add(Me.btnOK)
        Me.Controls.Add(Me.cruUnit)
        Me.Name = "frmNewSingleUnit"
        Me.Text = "Create Battlegroup Member"
        Me.ResumeLayout(False)

    End Sub

#End Region

    Public WriteOnly Property CurrentGame() As CampaignerGameData
        Set(ByVal Value As CampaignerGameData)
            ptrCurrentGame = Value
            cruUnit.CurrentGame = ptrCurrentGame
        End Set
    End Property

    Public Property Unit() As ChitUnitTypeMember
        Get
            Return ptrNewUnit
        End Get
        Set(ByVal Value As ChitUnitTypeMember)
            ptrNewUnit = Value
            If Not ptrNewUnit Is Nothing Then
                cruUnit.Unit = ptrNewUnit
            End If

        End Set
    End Property

    Public ReadOnly Property CancelPressed() As Boolean
        Get
            Return m_CancelPressed
        End Get
    End Property


    Private Sub btnOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOK.Click
        Me.Hide()
    End Sub

    Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancel.Click
        m_CancelPressed = True
        Me.Hide()
    End Sub
End Class
